/**
 * Project 68th
 */


#ifndef _SearchEngineServer_H
#define _SearchEngineServer_H

#include "ThreadPool.h"
#include "TcpServer.h"
#include "Message.h"

class SearchEngineServer {
public: 

    /**
     * @param threadNum
     * @param queSize
     * @param ip
     * @param port
     */
    SearchEngineServer(size_t threadNum, size_t queSize, const string& ip, unsigned short port);

    ~SearchEngineServer();

    void start();

    void stop();

    /**
     * @param con
     */
    void OnNewConnection(const TcpConnectionPtr & con);

    /**
     * @param con
     */
    void OnMessage(const TcpConnectionPtr & con);

    /**
     * @param con
     */
    void OnClose(const TcpConnectionPtr & con);
private: 
    ThreadPool _pool;
    TcpServer _server;
};

#endif //_SearchEngineServer_H
